//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.yaukie.base.exception;

import org.yaukie.base.constant.BaseResultConstant;
import org.yaukie.base.util.MessageTools;
import org.yaukie.base.util.StringTools;

public class UserDefinedException extends RuntimeException {
    private BaseResultConstant exception;
    private String module;
    private String code;
    private Object[] args;
    private String errorDetail;

    public UserDefinedException(String module, String code, Object[] args, String defaultMessage) {
        this.module = module;
        this.code = code;
        this.args = args;
        this.errorDetail = defaultMessage;
    }

    public UserDefinedException(BaseResultConstant exception) {
        this.exception = exception;
    }

    public UserDefinedException(BaseResultConstant exception, String msg) {
        this.exception = exception;
        this.errorDetail = msg;
    }

    public UserDefinedException(String module, String code, Object[] args) {
        this(module, code, args, (String)null);
    }

    public UserDefinedException(String module, String defaultMessage) {
        this(module, (String)null, (Object[])null, defaultMessage);
    }

    public UserDefinedException(String code, Object[] args) {
        this((String)null, code, args, (String)null);
    }

    public UserDefinedException(String defaultMessage) {
        this((String)null, (String)null, (Object[])null, defaultMessage);
    }

    public String getMessage() {
        String message = null;
        if (!StringTools.isEmpty(this.code)) {
            message = MessageTools.message(this.code, this.args);
        }

        if (message == null) {
            message = this.errorDetail;
        }

        return message;
    }

    public BaseResultConstant getException() {
        return this.exception;
    }

    public void setException(BaseResultConstant exception) {
        this.exception = exception;
    }

    public String getErrorDetail() {
        return this.errorDetail;
    }

    public void setErrorDetail(String errorDetail) {
        this.errorDetail = errorDetail;
    }
}
